home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / MPW / gzip 1.2.2 / gzip.1 < prev    next >
Encoding:
Text File  |  1993-06-22  |  12.0 KB  |  440 lines  |  [TEXT/MPS ]

  1. .PU
  2. .TH GZIP 1 local
  3. .SH NAME
  4. gzip, gunzip, zcat \- compress or expand files
  5. .SH SYNOPSIS
  6. .ll +8
  7. .B gzip
  8. .RB [ " \-acdfhlLnrtvV19 " ]
  9. .RB [ \-S\ suffix ]
  10. [
  11. .I "name \&..."
  12. ]
  13. .ll -8
  14. .br
  15. .B gunzip
  16. .RB [ " \-acfhlLnrtvV " ]
  17. .RB [ \-S\ suffix ]
  18. [
  19. .I "name \&..."
  20. ]
  21. .br
  22. .B zcat
  23. .RB [ " \-fhLV " ]
  24. [
  25. .I "name \&..."
  26. ]
  27. .SH DESCRIPTION
  28. .I Gzip
  29. reduces the size of the named files using Lempel-Ziv coding (LZ77).
  30. Whenever possible,
  31. each file is replaced by one with the extension
  32. .B "\&.gz,"
  33. while keeping the same ownership modes, access and modification times.
  34. (The default extension is
  35. .B "\-gz"
  36. for VMS,
  37. .B "z"
  38. for MSDOS, OS/2 FAT and Atari.)
  39. If no files are specified, the standard input is compressed to the
  40. standard output.
  41. .I Gzip
  42. will only attempt to compress regular files.
  43. In particular, it will ignore symbolic links.
  44. .PP
  45. If the new file name is too long for its file system,
  46. .I gzip
  47. truncates it and keeps the original file name in the compressed file.
  48. .I Gzip
  49. attempts to truncate only the parts of the file name longer than 3 characters.
  50. (A part is delimited by dots.) If the name consists of small parts only,
  51. the longest parts are truncated. For example, if file names are limited
  52. to 14 characters, gzip.msdos.exe is compressed to gzi.msd.exe.gz.
  53. Names are not truncated on systems which do not have a limit on file name
  54. length.
  55. .PP
  56. Compressed files can be restored to their original form using
  57. .I gzip -d
  58. or
  59. .I gunzip
  60. or
  61. .I zcat.
  62. If the original name saved in the compressed file is not suitable for its
  63. file system, a new name is constructed from the original one to make it
  64. legal.
  65. .PP
  66. .I gunzip
  67. takes a list of files on its command line and replaces each
  68. file whose name ends with .gz, -gz, .z, -z, _z or .Z
  69. and which begins with the correct magic number with an uncompressed
  70. file without the original extension.
  71. .I gunzip
  72. also recognizes the special extensions
  73. .B "\&.tgz"
  74. and
  75. .B "\&.taz"
  76. as shorthands for
  77. .B "\&.tar.gz"
  78. and
  79. .B "\&.tar.Z"
  80. respectively.
  81. When compressing,
  82. .I gzip
  83. uses the
  84. .B "\&.tgz"
  85. extension if necessary instead of truncating a file with a
  86. .B "\&.tar"
  87. extension.
  88. .PP
  89. .I gunzip
  90. can currently decompress files created by
  91. .I gzip, zip, compress, compress -H
  92. or
  93. .I pack.
  94. The detection of the input format is automatic.  When using
  95. the first two formats,
  96. .I gunzip
  97. checks a 32 bit CRC. For
  98. .I pack, gunzip
  99. checks the uncompressed length. The standard
  100. .I compress
  101. format was not designed to allow consistency checks. However
  102. .I gunzip
  103. is sometimes able to detect a bad .Z file. If you get an error
  104. when uncompressing a .Z file, do not assume that the .Z file is
  105. correct simply because the standard
  106. .I uncompress
  107. does not complain. This generally means that the standard
  108. .I uncompress
  109. does not check its input, and happily generates garbage output.
  110. The SCO compress -H format (lzh compression method) does not include a CRC
  111. but also allows some consistency checks.
  112. .PP
  113. Files created by
  114. .I zip
  115. can be uncompressed by gzip only if they have a single member compressed
  116. with the 'deflation' method. This feature is only intended to help
  117. conversion of tar.zip files to the tar.gz format. To extract zip files
  118. with several members, use
  119. .I unzip
  120. instead of
  121. .I gunzip.
  122. .PP
  123. .I zcat
  124. is identical to
  125. .I gunzip
  126. .B \-c.
  127. (On some systems,
  128. .I zcat
  129. may be installed as
  130. .I gzcat
  131. to preserve the original link to
  132. .I compress.)
  133. .I zcat
  134. uncompresses either a list of files on the command line or its
  135. standard input and writes the uncompressed data on standard output.
  136. .I zcat
  137. will uncompress files that have the correct magic number whether
  138. they have a
  139. .B "\&.gz"
  140. suffix or not.
  141. .PP
  142. .I Gzip
  143. uses the Lempel-Ziv algorithm used in
  144. .I zip
  145. and PKZIP.
  146. The amount of compression obtained depends on the size of the
  147. input and the distribution of common substrings.
  148. Typically, text such as source code or English
  149. is reduced by 60\-70%.
  150. Compression is generally much better than that achieved by
  151. LZW (as used in 
  152. .IR compress ),
  153. Huffman coding (as used in
  154. .IR pack ),
  155. or adaptive Huffman coding
  156. .RI ( compact ).
  157. .PP
  158. Compression is always performed, even if the compressed file is
  159. slightly larger than the original. The worst case expansion is
  160. a few bytes for the gzip file header, plus 5 bytes every 32K block,
  161. or an expansion ratio of 0.015% for large files. Note that the actual
  162. number of used disk blocks almost never increases.
  163. .I gzip
  164. preserves the mode, ownership and timestamps of files when compressing
  165. or decompressing.
  166.  
  167. .SH OPTIONS
  168. .TP
  169. .B \-a --ascii
  170. Ascii text mode: convert end-of-lines using local conventions. This option
  171. is supported only on some non-Unix systems. For MSDOS, CR LF is converted
  172. to LF when compressing, and LF is converted to CR LF when decompressing.
  173. .TP
  174. .B \-c --stdout --to-stdout
  175. Write output on standard output; keep original files unchanged.
  176. If there are several input files, the output consists of a sequence of
  177. independently compressed members. To obtain better compression,
  178. concatenate all input files before compressing them.
  179. .TP
  180. .B \-d --decompress --uncompress
  181. Decompress.
  182. .TP
  183. .B \-f --force
  184. Force compression or decompression even if the file has multiple links
  185. or the corresponding file already exists, or if the compressed data
  186. is read from or written to a terminal. If the input data is not in
  187. a format recognized by
  188. .I gzip,
  189. and if the option --stdout is also given, copy the input data without change
  190. to the standard ouput: let
  191. .I zcat
  192. behave as
  193. .I cat.
  194. If
  195. .B \-f
  196. is not given,
  197. and when not running in the background,
  198. .I gzip
  199. prompts to verify whether an existing file should be overwritten.
  200. .TP
  201. .B \-h --help
  202. Display a help screen and quit.
  203. .TP
  204. .B \-l --list
  205. For each compressed file, list the following fields:
  206.  
  207.     compressed size: size of the compressed file
  208.     uncompressed size: size of the uncompressed file
  209.     ratio: compression ratio (0.0% if unknown)
  210.     uncompressed_name: name of the uncompressed file
  211.  
  212. The uncompressed size is given as -1 for files not in gzip format,
  213. such as compressed .Z files. To get the uncompressed size for such a file,
  214. you can use:
  215.  
  216.     zcat file.Z | wc -c
  217.  
  218. In combination with the --verbose option, the following fields are also
  219. displayed:
  220.  
  221.     method: compression method
  222.     crc: the 32-bit CRC of the uncompressed data
  223.     date & time: time stamp for the uncompressed file
  224.  
  225. The compression methods currently supported are deflate, compress, lzh
  226. (SCO compress -H) and pack.  The crc is given as ffffffff for a file
  227. not in gzip format.
  228.  
  229. With --verbose, the size totals and compression ratio for all files
  230. is also displayed, unless some sizes are unknown. With --quiet,
  231. the title and totals lines are not displayed.
  232. .TP
  233. .B \-L --license
  234. Display the
  235. .I gzip
  236. license and quit.
  237. .TP
  238. .B \-n --no-name
  239. When compressing, do not save the original file name by default. (The
  240. original name is always saved if the name had to be truncated.) When
  241. decompressing, do not restore the original file name if present: remove
  242. only the
  243. .I gzip
  244. suffix from the compressed file name.
  245. .TP
  246. .B \-q --quiet
  247. Suppress all warnings.
  248. .TP
  249. .B \-r --recurse
  250. Travel the directory structure recursively. If any of the file names
  251. specified on the command line are directories, 
  252. .I gzip
  253. will descend into the directory and compress all the files it finds there
  254. (or decompress them in the case of
  255. .I gunzip
  256. ).
  257. .TP
  258. .B \-S .suf   --suffix .suf
  259. Use suffix .suf instead of .gz. Any suffix can be given, but suffixes
  260. other than .z and .gz should be avoided to avoid confusion when files
  261. are transferred to other.  A null suffix forces gunzip to  try
  262. decompression on all given files regardless of suffix, as in:
  263.  
  264.     gunzip -S "" *       (*.* for MSDOS)
  265.  
  266. Previous versions of gzip used
  267. the .z suffix. This was changed to avoid a conflict with
  268. .IR pack "(1)".
  269. .TP
  270. .B \-t --test
  271. Test. Check the compressed file integrity.
  272. .TP
  273. .B \-v --verbose
  274. Verbose. Display the name and percentage reduction for each file compressed
  275. or decompressed.
  276. .TP
  277. .B \-V --version
  278. Version. Display the version number and compilation options then quit.
  279. .TP
  280. .B \-# --fast --best
  281. Regulate the speed of compression using the specified digit
  282. .IR # ,
  283. where
  284. .B \-1
  285. or
  286. .B \-\-fast
  287. indicates the fastest compression method (less compression)
  288. and
  289. .B \-9
  290. or
  291. .B \-\-best
  292. indicates the slowest compression method (optimal compression).
  293. The default compression level is
  294. .BR \-6
  295. (that is, biased towards high compression at expense of speed).
  296. .SH "ADVANCED USAGE"
  297. Multiple compressed files can be concatenated. In this case,
  298. .I gunzip
  299. will extract all members at once. For example:
  300.  
  301.       gzip -c file1  > foo.gz
  302.       gzip -c file2 >> foo.gz
  303.  
  304. Then
  305.       gunzip -c foo
  306.  
  307. is equivalent to
  308.  
  309.       cat file1 file2
  310.  
  311. In case of damage to one member of a .gz file, other members can
  312. still be recovered (if the damaged member is removed). However,
  313. you can get better compression by compressing all members at once:
  314.  
  315.       cat file1 file2 | gzip > foo.gz
  316.  
  317. compresses better than
  318.  
  319.       gzip -c file1 file2 > foo.gz
  320.  
  321. If you want to recompress concatenated files to get better compression, do:
  322.  
  323.       zcat old.gz | gzip > new.gz
  324. .SH "ENVIRONMENT"
  325. The environment variable
  326. .B GZIP
  327. can hold a set of default options for
  328. .I gzip.
  329. These options are interpreted first and can be overwritten by
  330. explicit command line parameters. For example:
  331.       for sh:    GZIP="-8 -v"; export GZIP
  332.       for csh:   setenv GZIP "-8 -v"
  333.       for MSDOS: set GZIP=-8 -v
  334.  
  335. On Vax/VMS, the name of the environment variable is GZIP_OPT, to
  336. avoid a conflict with the symbol set for invocation of the program.
  337. .SH "SEE ALSO"
  338. znew(1), zcmp(1), zmore(1), zforce(1), gzexe(1), zip(1), unzip(1), compress(1),
  339. pack(1), compact(1)
  340. .SH "DIAGNOSTICS"
  341. Exit status is normally 0;
  342. if an error occurs, exit status is 1. If a warning occurs, exit status is 2.
  343. .PP
  344. Usage: gzip [-cdfhlLnrtvV19] [-S suffix] [file ...]
  345. .in +8
  346. Invalid options were specified on the command line.
  347. .in -8
  348. .IR file :
  349. not in gzip format
  350. .in +8
  351. The file specified to
  352. .I gunzip
  353. has not been compressed.
  354. .in -8
  355. .IR file:
  356. Corrupt input. Use zcat to recover some data.
  357. .in +8
  358. The compressed file has been damaged. The data up to the point of failure
  359. can be recovered using
  360. .in +8
  361. zcat file > recover
  362. .in -16
  363. .IR file :
  364. compressed with 
  365. .I xx
  366. bits, can only handle 
  367. .I yy
  368. bits
  369. .in +8
  370. .I File
  371. was compressed (using LZW) by a program that could deal with
  372. more 
  373. .I bits
  374. than the decompress code on this machine.
  375. Recompress the file with gzip, which compresses better and uses
  376. less memory.
  377. .in -8
  378. .IR file :
  379. already has .gz suffix -- no change
  380. .in +8
  381. The file is assumed to be already compressed.
  382. Rename the file and try again.
  383. .in -8
  384. .I file
  385. already exists; do you wish to overwrite (y or n)?
  386. .in +8
  387. Respond "y" if you want the output file to be replaced; "n" if not.
  388. .in -8
  389. gunzip: corrupt input
  390. .in +8
  391. A SIGSEGV violation was detected which usually means that the input file has
  392. been corrupted.
  393. .in -8
  394. .I "xx.x%"
  395. .in +8
  396. Percentage of the input saved by compression.
  397. (Relevant only for
  398. .BR \-v
  399. and
  400. .BR \-l \.)
  401. .in -8
  402. -- not a regular file or directory: ignored
  403. .in +8
  404. When the input file is not a regular file or directory,
  405. (e.g. a symbolic link, socket, FIFO, device file), it is
  406. left unaltered.
  407. .in -8
  408. -- has 
  409. .I xx 
  410. other links: unchanged
  411. .in +8
  412. The input file has links; it is left unchanged.  See
  413. .IR ln "(1)"
  414. for more information. Use the
  415. .B \-f
  416. flag to force compression of multiply-linked files.
  417. .in -8
  418. .SH CAVEATS
  419. When writing compressed data to a tape, it is generally necessary to
  420. pad the output with zeroes up to a block boundary. When the data is
  421. read and the whole block is passed to
  422. .I gunzip
  423. for decompression,
  424. .I gunzip
  425. detects that there is extra trailing garbage after the compressed data
  426. and emits a warning by default. You have to use the --quiet option to
  427. suppress the warning. This option can be set in the
  428. .B GZIP
  429. environment variable as in:
  430.     for sh:    GZIP="-q"  tar xfz /dev/rmt/datn
  431.     for csh:   (setenv GZIP "-q"; tar xfz /dev/rmt/datn)
  432.  
  433. In the above example, gzip is invoked implicitly by the -z option
  434. of GNU tar. Make sure that the same block size (-b option of
  435. tar) is used for reading and writing compressed data on tapes.
  436. .SH BUGS
  437. The --list option reports incorrect sizes if they exceed 2 gigabytes.
  438. The --list option reports sizes as -1 and crc as ffffffff if the
  439. compressed file is on a non seekable media.
  440.